package cn.lg.soar.system.biz.modules.general.client;

import cn.lg.soar.core.annotations.ApiClient;
import cn.lg.soar.system.api.constant.ModuleConst;
import cn.lg.soar.system.api.model.TemplateCache;
import cn.lg.soar.system.api.service.ITemplateApi;
import cn.lg.soar.system.biz.modules.general.service.TemplateService;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luguoxiang
 * @date 2022/1/3
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Hidden
@ApiClient("boot")
@RestController
@RequestMapping(ModuleConst.CLIENT_PATH + "/template")
public class TemplateApiClient implements ITemplateApi {

    @Autowired
    private TemplateService service;

    @RequestMapping(value = "getById", method = RequestMethod.GET)
    @Override
    public TemplateCache getById(@RequestParam(name = "id") Long id) {
        return service.getCacheById(id);
    }

    @RequestMapping(value = "getByCode", method = RequestMethod.GET)
    @Override
    public TemplateCache getByCode(@RequestParam(name = "code") String code) {
        return service.getCacheByCode(code);
    }

}
